Part One: The Scene Graph


Part Two: The VRML Source Code (ballint.wrl)

Here is the entire VRML 2.0 source code. Type (or paste) this code into a file called "ballint.wrl".

#VRML V2.0 utf8

Viewpoint {
    position 0 0 3
}

DEF HOURGLASS TimeSensor {
  loop TRUE
  enabled TRUE
  cycleInterval 3
  stopTime -1
}

DEF BALLINTP PositionInterpolator{
  key = [0, 0.25, 0.5, 0.75, 1]
  keyValue = [
    0 0 0 
    0.2 0.2 0.2
    0.6 0.6 0.6
    0.2 0.2 0.2
    0 0 0 
  ]
}

#the object to be animated
DEF BALL Transform {
  translation 0 0 0
  children [        
    Shape {
      appearance Appearance {
        material DEF BALLMAT Material {}
      }
      geometry Sphere { radius 0.1 }
    }
  ]
}

ROUTE HOURGLASS.fraction_changed TO BALLINTP.set_fraction
ROUTE BALLINTP.value_changed TO BALL.set_translation